'use strict'
const path = require('path')
const px2rem = require('postcss-plugin-px2rem')

// eslint-disable-next-line no-unused-vars
function resolve(dir) {
    return path.join(__dirname, dir)
}

// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
    /**
     * You will need to set publicPath if you plan to deploy your site under a sub path,
     * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
     * then publicPath should be set to "/bar/".
     * In most cases please use '/' !!!
     * Detail: https://cli.vuejs.org/config/#publicpath
     */
    publicPath: '/',
    outputDir: 'dist',
    assetsDir: 'static',
    lintOnSave: process.env.NODE_ENV === 'development',
    productionSourceMap: false,
    devServer: {
        port: 8080,
        open: true,
        overlay: {
            warnings: false,
            errors: true
        }
        // proxy: {
        //   // detail: https://cli.vuejs.org/config/#devserver-proxy
        //   '/': {
        //     ws: false,
        //     target: 'https://test-api-2.sjdywh.com/v1/admin_api',
        //     changeOrigin: true
        //   }
        // }
    },
    css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    px2rem({
                        exclude: /(node_modules)/,
                        mediaQuery: false,
                        minPixelValue: 3
                    })
                ]
            }
        }
    },
}
